﻿#pragma once
#include "XyNet/Common/Singleton.h"
#include "XyNet/Crypto/CryptoPP.h"

namespace XyNet
{
	/// crc摘要
	class XYNET_API X917Random
		: public CryptoPP::AutoSeededX917RNG<CryptoPP::AES>, public DefaultObject<X917Random>
	{
		typedef CryptoPP::AutoSeededX917RNG<CryptoPP::AES> super;

	public:
		virtual byte GenerateByte() override;

		virtual unsigned int GenerateBit() override;

		virtual CryptoPP::word32 GenerateWord32(
			CryptoPP::word32 min = 0, CryptoPP::word32 max = 0xffffffffUL) override;

		virtual void GenerateBlock(byte *output, size_t size) override;

	private:
		mutex _mutex;
	};
}